import { createApp } from 'vue'
import App from '@/App.vue'
import router from '@/router'
import 'element-plus/dist/index.css'
import '@/assets/css/animate.css'
import { createStore } from "@/pinia"
import "@/assets/css"
import { ElButton } from '@/components/button'
import ElLoading from '@/components/loading/index'
import "@/assets/icon/iconfont.css"
import { formatDate } from '@vueuse/core'
import directiveRegister from '@/directive'
import { setRequestInstance } from "@usehook/useRequest"
import request from "@/utils/request"

setRequestInstance(request)

const app = createApp(App)
createStore(app)
app.use(router)
app.use(ElButton)
app.use(ElLoading)
directiveRegister(app)

Date.prototype.format = function (fmt) {
    return formatDate(this, fmt)
}

String.prototype.rsplit = function(sep, maxsplit) {
    var split = this.split(sep);
    return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].concat(split.slice(-maxsplit)) : split;
}

app.mount('#app')
